<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="安装单完工" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/BillList.css" />
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function doShow(id){
		var url="/business/SetuBillEdit.ihtm?id="+id;
		ShowIframe("安装单",url,1024,500,"refreshWin()",1024,600);
	}
	function doComp(id){
		var url="/business/SetuBillComp.ihtm?id="+id;
		ShowIframeNoScroll("安装单完工",url,500,400,"refreshWin()",1024,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location=window.location;
		}
	}
	function checkDateStr(type){
		var typeName,objIdPrev;
		if(type=="BILL"){
			typeName="派单";
			objIdPrev="bill";
		}else if(type=="PLAN"){
			typeName="计划完工";
			objIdPrev="plan";
		}else if(type=="REAL"){
			typeName="实际完工";
			objIdPrev="real";
		}
		var startDate=document.getElementById(objIdPrev+"_start").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择'+typeName+'开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框',typeName+'开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框',typeName+'开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById(objIdPrev+"_end").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择'+typeName+'结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框',typeName+'结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框',typeName+'结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function createPageParaStr(){
		var str="bill_start="+encodeURIComponent(document.getElementById("bill_start").value);
		str=str+"&bill_end="+encodeURIComponent(document.getElementById("bill_end").value);
		str=str+"&bb_code="+encodeURIComponent(document.getElementById("bb_code").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("est_name").value);
		str=str+"&lm="+encodeURIComponent(document.getElementById("lm").value);
		str=str+"&phon="+encodeURIComponent(document.getElementById("phon").value);
		str=str+"&cont="+encodeURIComponent(document.getElementById("cont").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("bill_code").value);
		str=str+"&crea_name="+encodeURIComponent(document.getElementById("crea_name").value);
		str=str+"&mng_name="+encodeURIComponent(document.getElementById("mng_name").value);
		str=str+"&setu_name="+encodeURIComponent(document.getElementById("setu_name").value);
		str=str+"&ts_id="+document.getElementById("ts_id").value;
		
		return str;
	}
	
	function createProgramParaStr(){
		var str="bill_start="+encodeURIComponent(document.getElementById("hid_bill_start").value);
		str=str+"&bill_end="+encodeURIComponent(document.getElementById("hid_bill_end").value);
		str=str+"&bb_code="+encodeURIComponent(document.getElementById("hid_bb_code").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("hid_est_name").value);
		str=str+"&lm="+encodeURIComponent(document.getElementById("hid_lm").value);
		str=str+"&phon="+encodeURIComponent(document.getElementById("hid_phon").value);
		str=str+"&cont="+encodeURIComponent(document.getElementById("hid_cont").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("hid_bill_code").value);
		str=str+"&crea_name="+encodeURIComponent(document.getElementById("hid_crea_name").value);
		str=str+"&mng_name="+encodeURIComponent(document.getElementById("hid_mng_name").value);
		str=str+"&setu_name="+encodeURIComponent(document.getElementById("hid_setu_name").value);
		str=str+"&ts_id=${tsId}";
		
		return str;
	}
	
	function doSearch(){
		var str;
		if(IsAdvSearch){//高级
			str="search_type=1";
			
			if(document.getElementById("cb_bill_date").checked){
				if(checkDateStr("BILL")){
					str=str+"&cb_bill_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_bb_code").checked){
				var bbCode=document.getElementById("bb_code").value.trim();
				if(bbCode==null || bbCode==""){
					ShowAlert('提示框','请输入业务单号',200,100);
					return;
				}
				str=str+"&cb_bb_code=1";
			}
			if(document.getElementById("cb_est").checked){
				var estName=document.getElementById("est_name").value.trim();
				if(estName==null || estName==""){
					ShowAlert('提示框','请输入订货单位',200,100);
					return;
				}
				str=str+"&cb_est=1";
			}
			if(document.getElementById("cb_lm").checked){
				var lm=document.getElementById("lm").value.trim();
				if(lm==null || lm==""){
					ShowAlert('提示框','请输入联系人姓名',200,100);
					return;
				}
				str=str+"&cb_lm=1";
			}
			if(document.getElementById("cb_phon").checked){
				var phon=document.getElementById("phon").value.trim();
				if(phon==null || phon==""){
					ShowAlert('提示框','请输入电话',200,100);
					return;
				}
				str=str+"&cb_phon=1";
			}
			if(document.getElementById("cb_cont").checked){
				var cont=document.getElementById("cont").value.trim();
				if(cont==null || cont==""){
					ShowAlert('提示框','请输入摘要',200,100);
					return;
				}
				str=str+"&cb_cont=1";
			}
			if(document.getElementById("cb_bill_code").checked){
				var billCode=document.getElementById("bill_code").value.trim();
				if(billCode==null || billCode==""){
					ShowAlert('提示框','请输入安装单号',200,100);
					return;
				}
				str=str+"&cb_bill_code=1";
			}
			if(document.getElementById("cb_crea").checked){
				var creaName=document.getElementById("crea_name").value.trim();
				if(creaName==null || creaName==""){
					ShowAlert('提示框','请输入开单人姓名',200,100);
					return;
				}
				str=str+"&cb_crea=1";
			}
			if(document.getElementById("cb_mng").checked){
				var mngName=document.getElementById("mng_name").value.trim();
				if(mngName==null || mngName==""){
					ShowAlert('提示框','请输入负责人姓名',200,100);
					return;
				}
				str=str+"&cb_mng=1";
			}
			if(document.getElementById("cb_setu").checked){
				var setuName=document.getElementById("setu_name").value.trim();
				if(setuName==null || setuName==""){
					ShowAlert('提示框','请输入安装人员姓名',200,100);
					return;
				}
				str=str+"&cb_setu=1";
			}
			if(document.getElementById("cb_ts").checked){
				var tsId=document.getElementById("ts_id").value;
				if(tsId==null || tsId=="" || tsId=="0"){
					ShowAlert('提示框','请选择帐套',200,100);
					return;
				}
				str=str+"&cb_ts=1";
			}
		}else{//快速
			str="search_type=2";
			if(!checkDateStr("BILL")){
				return;
			}
		}
		
		var paraStr=createPageParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		window.location="/business/SetuBillListForComp.ihtm?"+str;
	}
	function doGo(pageIndex){
		var str=getSearchCondition();
		str=str+"&current_page="+pageIndex;
		window.location="/business/SetuBillListForComp.ihtm?"+str;
	}
	
	function getSearchCondition(){
		var searchType="${searchType}";
		var str="search_type="+searchType;
		if(searchType=="1"){//高级
			<c:if test="${cbBillDate=='1'}">str=str+"&cb_bill_date=1";</c:if>
			<c:if test="${cbCrea=='1'}">str=str+"&cb_crea=1";</c:if>
			<c:if test="${cbMng=='1'}">str=str+"&cb_mng=1";</c:if>
			<c:if test="${cbEst=='1'}">str=str+"&cb_est=1";</c:if>
			<c:if test="${cbSetu=='1'}">str=str+"&cb_setu=1";</c:if>
			<c:if test="${cbBillCode=='1'}">str=str+"&cb_bill_code=1";</c:if>
			<c:if test="${cbCont=='1'}">str=str+"&cb_cont=1";</c:if>
			<c:if test="${cbLm=='1'}">str=str+"&cb_lm=1";</c:if>
			<c:if test="${cbPhon=='1'}">str=str+"&cb_phon=1";</c:if>
			<c:if test="${cbBbCode=='1'}">str=str+"&cb_bb_code=1";</c:if>
			<c:if test="${cbTs=='1'}">str=str+"&cb_ts=1";</c:if>
		}else{//快速
			
		}
		
		var paraStr=createProgramParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		
		return str;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if(ob_arr.length>=it.getAttribute("index")){
			str=ob_arr[it.getAttribute("index")-1].value;
		}
		if(str==""){
			return;
		}
		doShow(str);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		//Window_Onload();
	}
	function checkInput(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doAutoCheck(objId){
		document.getElementById(objId).checked=true;
	}
	function selectStafferName(objId,checkObjId){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"selectStafferNameCallBack('"+objId+"','"+checkObjId+"')");
	}
	function selectStafferNameCallBack(objId,checkObjId){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById(objId).value=arr[1];
			doAutoCheck(checkObjId);
		}
	}
	function setDate(type,objType){
		var d=new Date();
		var startStr="";
		var endStr="";
		if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="TODAY"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="YESTERDAY"){
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		if(objType=="BILL"){
			document.getElementById("bill_start").value=startStr;
			document.getElementById("bill_end").value=endStr;
			doAutoCheck("cb_bill_date");
		}else if(objType=="PLAN"){
			document.getElementById("plan_start").value=startStr;
			document.getElementById("plan_end").value=endStr;
			doAutoCheck("cb_plan_date");
		}else if(objType=="REAL"){
			document.getElementById("real_start").value=startStr;
			document.getElementById("real_end").value=endStr;
			doAutoCheck("cb_real_date");
		}
	}
	function selectEstName(){
		var url="/base/EstablishmentListForSelect.ihtm?type=CLIENT";
		ShowIframe("选择客户",url,900,500,"selectEstNameCallBack()");
	}
	function selectEstNameCallBack(){
		if(popRetVal!=null){
			document.getElementById("est_name").value=popRetVal[1];
			doAutoCheck("cb_est");
		}
	}
	function doDownload(){
		var str=getSearchCondition();
		window.location="/business/SetuBillListForComp.ihtm?content_type=EXCEL&"+str;
	}
</script>
</head>
<body oncontextmenu="return false">
<div class="Wrap"><!-- 页面主框架 -->
    
	<div id="ListContainer" class="Container"><!-- 主体容器 -->
	    
	    <!-- 标题栏 -->
	    <div class="Heading BillIcon">
	        <div class="HeadingContent">
	            <h1>安装单完工</h1>
	            <span class="Note">登记安装人员并分配业绩</span>
	        </div>
	    </div>
	
		<!-- 主内容 -->
		<div class="Content">
	        <!-- 筛选控件栏 -->
	        <div class="FilterBar ClearFix">
	            <div class="SearchIcon"></div>
	            <span class="fl">
	            	<table class="MoreOption" cellpadding="0" cellspacing="0">
	            		<th class="c1" width="80px">
	            			<input type="checkbox" name="cb_bb_code" id="cb_bb_code" <c:if test="${cbBbCode=='1' || searchType=='2'}">checked="true"</c:if> style="visibility:hidden;" />
			        		业务单号
	            			
	            		</th>
	            		<td class="c1" width="360px">
	            			<input type="text" class="TextBox" maxlength="50" name="bb_code" id="bb_code" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_bb_code');" value="<c:out value="${bbCode}" />">
							<input type="hidden" id="hid_bb_code" value="<c:out value="${bbCode}" />">
	            		</td>
	            	</table>
	            </span>
				<span class="fr">
	            	<a href="javascript:;" id="lnkMoreOption">更多查询选项</a>
		  			<input type="button" value=" 查 询" onClick="doSearch();" class="buttom search-but" id="sSearchButton" name="sSearchButton">
		  			<input type="button" value=" 导 出" onClick="doDownload();" class="buttom search-out" id="sDownloadButton" name="sDownloadButton" <c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_EXPO;')!=-1}">disabled="true"</c:if>>
	            </span>
				<div id="dvMoreOptionBox" class="MoreOptionBox" style="display:none;">
					<table class="MoreOption" cellpadding="0" cellspacing="0">
						<tr>
							<th class="c1" width="80px">
			        			<input type="checkbox" name="cb_bill_date" id="cb_bill_date" <c:if test="${cbBillDate=='1'}">checked="true"</c:if> />
	            				派单日期
			        		</th>
			    			<td width="260px">
			        			<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_bill_date');" id="bill_start" name="bill_start" value="<c:out value="${billStart}" />">
				            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('bill_start'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_bill_date\')');">
				            	<input type="hidden" id="hid_bill_start" value="<c:out value="${billStart}" />">
				            	至
				            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_bill_date');" id="bill_end" name="bill_end" value="<c:out value="${billEnd}" />">
				            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('bill_end'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_bill_date\')');">
				            	<input type="hidden" id="hid_bill_end" value="<c:out value="${billEnd}" />">
			    			</td>
			    			<th class="c2" width="80px">
								<input type="checkbox" name="cb_bill_code" id="cb_bill_code" <c:if test="${cbBillCode=='1'}">checked="true"</c:if>>
			        			安装单号
			        		</th>
			    			<td class="c3" width="280px">
			    				<input type="text" class="TextBox" maxlength="50" name="bill_code" id="bill_code" onFocus="doAutoCheck('cb_bill_code');" onKeyUp="checkInput();" value="<c:out value="${billCode}" />">
								<input type="hidden" id="hid_bill_code" value="<c:out value="${billCode}" />">
			        		</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			    				<input type="checkbox" name="cb_est" id="cb_est" <c:if test="${cbEst=='1'}">checked="true"</c:if>>
			        			订货单位
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="est_name" id="est_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_est');" value="<c:out value="${estName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectEstName();" />
								<input type="hidden" id="hid_est_name" value="<c:out value="${estName}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_setu" id="cb_setu" <c:if test="${cbSetu=='1'}">checked="true"</c:if>>
			        			安装人员
			        		</th>
			        		<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="setu_name" id="setu_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_setu');" value="<c:out value="${setuName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('setu_name','cb_setu');" />
								<input type="hidden" id="hid_setu_name" value="<c:out value="${setuName}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
								<input type="checkbox" name="cb_lm" id="cb_lm" <c:if test="${cbLm=='1'}">checked="true"</c:if>>
			        			联系人
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="lm" id="lm" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_lm');" value="${lm}" >
								<input type="hidden" id="hid_lm" value="<c:out value="${lm}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_mng" id="cb_mng" <c:if test="${cbMng=='1'}">checked="true"</c:if>>
			        			安装负责人
			        		</th>
			        		<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="mng_name" id="mng_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_mng');" value="<c:out value="${mngName}" />">
			        			<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('mng_name','cb_mng');" />
								<input type="hidden" id="hid_mng_name" value="<c:out value="${mngName}" />">
			    			</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_phon" id="cb_phon" <c:if test="${cbPhon=='1'}">checked="true"</c:if>>
			        			电话
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="phon" id="phon" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_phon');" value="${phon}" >
								<input type="hidden" id="hid_phon" value="<c:out value="${phon}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_creater" id="cb_crea" <c:if test="${cbCrea=='1'}">checked="true"</c:if>>
			        			开单人
			        		</th>
			        		<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="crea_name" id="crea_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_crea');" value="<c:out value="${creaName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('crea_name','cb_crea');" />
								<input type="hidden" id="hid_crea_name" value="<c:out value="${creaName}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
								<input type="checkbox" name="cb_cont" id="cb_cont" <c:if test="${cbCont=='1'}">checked="true"</c:if>>
			        			业务单摘要
			        		</th>
			    			<td class="c1">
			    				<input type="text" class="TextBox" maxlength="50" name="cont" id="cont" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cont');" value="${cont}" >
								<input type="hidden" id="hid_cont" value="<c:out value="${cont}" />">
			        		</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_ts" id="cb_ts" <c:if test="${cbTs=='1'}">checked="true"</c:if>>
	                        	账套
			        		</th>
			    			<td class="c3">
			        			<select name="ts_id" id="ts_id" onFocus="doAutoCheck('cb_ts');">
				    				<option value="0">==请选择账套==</option>
				    				<c:forEach var="item" items="${tsList}">
									<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option></c:forEach>
								</select>
			        		</td>
						</tr>
					</table>
					
					<div class="OptionOrderBy">
						<span class="fr"><a href="javascript:;" id="lnkHiddenOption">隐藏查询选项</a></span>
	                </div>
				</div>
			</div>
			
			<!-- 提示信息显示栏 -->
	        <div class="MsgBar">
	            <%@include file="../inc/AlertMsg.jsp"%>
	        </div>
			<div class="table-list">
		  		<table width="100%">      
					<tr >	
						<th width="12%">安装单号</td>
						<th width="8%">派单日期</th>
						<th width="10%">订货单位</th>
						<th width="12%">业务单号</td>
						<th width="14%">业务摘要</td>
						<th width="8%">金额</td>
						<th width="8%">计划完工</th>
						<th width="8%">安装人员</th>
						<th width="6%">负责人</th>
						<th width="6%">开单人</th>
						<th width="8%">操作</th>
					</tr>
					<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<c:set var="defaultFontColor" value="black" />
					<c:if test="${item[0].exam=='Y'}"><c:set var="defaultFontColor" value="blue" /></c:if>
					<c:if test="${item[0].comp=='Y'}"><c:set var="defaultFontColor" value="red" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" style="color:${defaultFontColor};cursor:pointer;" defaultFontColor="${defaultFontColor}" ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td>
							<input type="radio" name='query_checkbox' value="${item[0].id}" style="display:none">
							${item[0].billCode}
						</td>
						<td><fmt:formatDate value="${item[0].billDate}" pattern="yyyy-MM-dd HH:mm"/></td>
						<td>${item[1]}</td>
						<td>${item[2]}</td>
						<td>${item[3]}</td>
						<td>${item[0].cost}</td>
						<td><fmt:formatDate value="${item[0].planDate}" pattern="yyyy-MM-dd HH:mm"/></td>
						<td>${item[0].setuNameStr}</td>
						<td>${item[0].mngName}</td>
						<td>${item[0].creaName}</td>
						<td>
							<a href="javascript:doShow('${item[0].id}');">查看</a>
							<a href="javascript:doComp('${item[0].id}');">完工</a>
						</td>
					</tr>
					</c:forEach>
				</table>
			</div>

			<!-- 底栏 分页、操作等 -->
	        <div class="BottomToolBar ClearFix">
			    <%@include file="../inc/Pages.jsp"%>
	        </div>
			
		</div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	function ChangeWindowSize( container, maxWidth ){
	    setTimeout( function(){
	        var w1 = document.documentElement.clientWidth-40;
	        if( w1>maxWidth ) w1 = maxWidth;
	        else if( w1<970 ) w1 = 960;
	        container.style.width = w1+'px';
	    }, 300 );
	}
	var IsAdvSearch = false;
	(function(){
		doInit();
	    var ListContainer = document.getElementById('ListContainer');
	    ChangeWindowSize( ListContainer, 2020 );    // 超过 1280 的最大 1260 ，不全部铺满
	
	    var lnkMoreOption   = document.getElementById('lnkMoreOption');
	    var lnkHiddenOption = document.getElementById('lnkHiddenOption');
	    lnkMoreOption.onclick = function(){
	    	IsAdvSearch = true;
	        document.getElementById('dvMoreOptionBox').style.display = 'block';
	        document.getElementById('cb_bb_code').style.visibility = 'visible';
	        this.style.visibility = 'hidden';
	    };
	    lnkHiddenOption.onclick = function(){
	    	IsAdvSearch = false;
	        document.getElementById('dvMoreOptionBox').style.display = 'none';
	        document.getElementById('cb_bb_code').style.visibility = 'hidden';
	        lnkMoreOption.style.visibility = 'visible';
	    };
	})();
</script>
